package com.wosai.register.security;

import org.springframework.security.crypto.password.PasswordEncoder;

import com.wosai.register.util.SecurityUtil;

public class MyPasswordEncoder implements PasswordEncoder {

    @Override
    public String encode(CharSequence rawPassword) {
        return SecurityUtil.encodePassword(rawPassword.toString());
    }

    @Override
    public boolean matches(CharSequence rawPassword, String encodedPassword) {
        String digest = SecurityUtil.encodePassword(rawPassword.toString());
        return digest.equals(encodedPassword);
    }

}
